home *** CD-ROM | disk | FTP | other *** search
/ Clinical Endocrinology / Clinical Endocrinology.iso / pc / 00000000 / history.dir / 00003_Script_3 < prev    next >
Text File  |  1995-11-09  |  4KB  |  138 lines

  1. -- This handler is called from the parent movie when
  2. -- the instruction to navigate to a new movie is given.
  3. -- It stores the movie reference as a global. 
  4. -- This reference is taken from the grey line in the
  5. -- movie's menu text. The movie's pathname is also stored.
  6. -- With these globals it builds a list of movies which 
  7. -- have been visited. Each variable is stored in a
  8. -- different field. The reference field is visible to 
  9. -- the user, and the pathname field is kept hidden.
  10.  
  11. on updateHistory
  12.   global lastpathName, movieRef, greyLine
  13.   
  14.   put the text of field "History Field" into oldText
  15.   if oldText = "" then
  16.     put movieRef into oldText
  17.   else
  18.     put movieRef & RETURN before oldtext
  19.   end if
  20.   put oldText into field "History Field"
  21.   
  22.   setTextFormat
  23.   
  24.   put the text of field "Pathname Field" into oldText
  25.   if oldText = "" then
  26.     put lastpathName into oldText
  27.   else
  28.     put lastpathName & RETURN before oldtext
  29.   end if
  30.   put oldText into field "Pathname Field"
  31.   
  32.   put the number of lines in field "Pathname Field" into theLines
  33.   if theLines > 20 then
  34.     delete line 1 of field "Pathname Field"
  35.     delete line 1 of field "History Field"
  36.   end if
  37.   
  38.   hiliteNewLine
  39.   
  40. end updateHistory
  41. ------------------------------------------------------
  42. -- Handler which takes a global which is a refernce to a line
  43. -- in a text castmember which represents a pathname. This is
  44. -- either the last line, by default, or a user defined line.
  45. -- It takes the pathname and instructs the stage/parent window
  46. -- to jump to the new movie. Handlers are called to redefine
  47. -- the history list.
  48.  
  49. on goToHistory
  50.   global lineSelected
  51.   
  52.   if voidP(lineSelected) then
  53.     alert "Sorry, nowhere to go!"
  54.     abort
  55.   end if
  56.   
  57.   put the text of field "Pathname Field" into theText
  58.   if theText = "" then
  59.     alert "Sorry, nowhere to go!"
  60.     abort
  61.   end if
  62.   
  63.   put line lineSelected of theText into newPath
  64.   --put word 1 of line lineSelected of field "Frame Field" into theFrame
  65.   --scrubPaths
  66.   --scrubMovieRefs
  67.   
  68.   tell the stage
  69.     go movie newPath
  70.   end tell
  71.   
  72.   hiliteNewLine
  73.   
  74. end gotoHistory
  75. ------------------------------------------------------
  76. -- Handler to delete all lines before the selection
  77.  
  78. on scrubPaths
  79.   global lineSelected
  80.   
  81.   put the text of field "Pathname Field" into theText
  82.   put the number of lines in theText into theLines
  83.   delete line (lineSelected + 1) to theLines of field ¼
  84. "Pathname Field"
  85.   
  86. end scrubPaths
  87. ------------------------------------------------------
  88. -- Handler to delete all lines before the selection
  89.  
  90. on scrubMovieRefs
  91.   global lineSelected
  92.   
  93.   put the text of field "History Field" into theText
  94.   put the number of lines in theText into theLines
  95.   delete line (lineSelected + 1) to theLines of field ¼
  96. "History Field"
  97.   
  98. end scrubMovieRefs
  99. ------------------------------------------------------
  100. -- When the MIAW recieves new info on the last movie
  101. -- the reference and pathname are updated to text.
  102. -- This handler hilites that new info.
  103.  
  104. on hiliteNewLine
  105.   global lineSelected
  106.   
  107.   put the text of field "History Field" into theText
  108.   put the number of lines in theText into theLines
  109.   hilite line theLines of field "History Field"
  110.   updateStage
  111.   set lineSelected = theLines
  112. end hiliteNewLine
  113. ------------------------------------------------------
  114. -- Handler called to tell the stage to hide this MIAW.
  115.  
  116. on hideThisMovie
  117.   
  118.   tell the stage
  119.     goBackOne
  120.   end tell
  121. end hideThisMovie
  122. ------------------------------------------------------
  123. on setTextFormat
  124.   
  125.   if the machineType <> 265 then
  126.     set helveticaText = "Helvetica"
  127.   else
  128.     set helveticaText = "Arial"
  129.   end if
  130.   
  131.   if voidP(HelveticaText) = false then
  132.     set the textFont of field "History Field" = HelveticaText
  133.   end if
  134.   
  135.   set the textSize of field "History Field" = 10
  136.   
  137. end setTextFormat
  138.